package com.flower8.quartz;

import com.flower8.service.RedbagService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

/**
 * @Description: 过期红包定时任务
 * @Author: tanglin
 * @Date: 2019/10/25 17:53
 * @Version: 1.0
 */
@Service
public class RedbagJob {
    private static final Logger log = LoggerFactory.getLogger(RedbagJob.class);

    @Autowired
    private RedbagService redbagService;

    /**
     * 每天晚上23点59分定时扫描过期红包
     * @throws Exception
     */
    @Scheduled(cron = "0 59 23 * * ?")
    public void updateExpireRedbag(){
        try {
            redbagService.updateExpireRedbag();
        }catch (Exception e){
            e.printStackTrace();
            log.error(e.getMessage());
        }
    }
}
